package cn.gson.zuche.controller.user;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/forgetcode")
public class FotgetCodeServlet extends HttpServlet {
			int random=0;
			String getrandom=null;
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		random=(int)((Math.random()*9+1)*1000);
		getrandom=random+"";
		System.out.println(getrandom);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		System.out.println(getrandom);
		String code=req.getParameter("mobilecode");
		System.out.println(code);
		PrintWriter out = resp.getWriter();
		if(!getrandom.equalsIgnoreCase(code)){
			 out.print("false");
		}
	}
}
